<template>
  <div class="wrapper">
    <!-- <van-button type="primary" @click="toGenerator">主要按钮</van-button>
    <van-button type="primary" @click="subscribe">subscribe</van-button>
    <van-button type="primary" @click="publish">publish</van-button> -->

    <!-- <img src="@assets/org.jpg" alt=""> -->
    <div class="triangle"></div>
  </div>
</template>
<script>
  import { mapGetters } from 'vuex';
  export default {
    computed: mapGetters({ location: 'generator/location' }),
    data() {
      return {
        address: '',
        websocket: ''
      };
    },
    methods: {
      initializeWbs() {
        var _this = this;
        if ('WebSocket' in window) {
          _this.websocket = new WebSocket('ws://localhost:8080/WebSocket2/websocket/');
        } else {
          alert('当前浏览器 Not support websocket');
        }
      },
      toGenerator() {
        //this.$router.replace('/generator/index');
        //window.$utils.scanner(this.locationResult);
        var _this = this;
        var url = '/study/mqtt/init';
        var mes = { a: 1, b: 2 };
        _this.$axios.post(url, mes).then((rsp) => {
          console.log(rsp);
        });
      },
      subscribe() {
        var _this = this;
        var url = '/study/mqtt/subscribe';
        var mes = 'subscribe';
        _this.$axios.post(url, mes).then((rsp) => {
          console.log(rsp);
        });
      },
      publish() {
        var _this = this;
        var url = '/study/mqtt/publish';
        var mes = 'publish';
        _this.$axios.post(url, mes).then((rsp) => {
          console.log(rsp);
        });
      },
      locationResult(v) {
        console.log(v);
        this.address = v;
      },
      onClickLeft() {
        var _this = this;
        console.log(_this, '888*********8888');
        window.$utils.exit();
      },
      onClickRight() {
        var _this = this;
        _this.$toast(99);
      },
      xxx(object) {
        console.log(object);
        //this.address=JSON.stringify(object);
      }
    },
    mounted() {
      var _this = this;
      console.log(_this);
    }
  };
</script>
<style scoped lang="less">
  .wrapper {
    position:relative;
  }
  .triangle {
    width:0;
    height:0;
  }
  .spec {
    position:absolute;
    width: 300px;
    left:35px;
    bottom:120px;
    &__title {
      width:100%;
      font-size: 6px;
      line-height: 6px;
      text-align:left;
      color:rgb(251,251,84)
    }
    &__content {
      width:auto;
      height:2px;
      font-size: 3px;
      line-height:5px;
      text-align:left;
      color:white;
    }
  }
</style>
